#!/bin/sh

if [ -z "$logdir" ];
then
logdir=~/log
fi
if [ -z "$logname" ];
then
logname="zdlog"
fi

writelogfile()
{

if [ ! -d $logdir ];
then
  mkdir -p $logdir 
fi

tee -a ${logdir}/log.${logname}-`date +%Y%m%d`

}


infolog()
{
   echo "`date "+%Y-%m-%d|%H:%M:%S"`|INFO|$@"  | writelogfile 
}


errlog()
{
   echo "`date "+%Y-%m-%d|%H:%M:%S"`|ERROR|$@"  | writelogfile 
}




